﻿using System;
using TI_BLE_HCI_ClientLib.GenericHCIEntities;
using TI_BLE_HCI_ClientLib.HCIBaseEntities;

namespace TI_BLE_HCI_ClientLib.HCIEvents
{
    public class HCIEvent_GAP_Link_Terminated : HCIVendorSpecificEvent
    {
        public enum ReasonEnum
        {
            SupervisorTimeout = 0x08,
            PeerRequested = 0x13,
            HostRequested = 0x16,
            ControlPacketTimeout = 0x22,
            ControlPacketInstantPassed = 0x28,
            LSTO_Violation = 0x3b,
            MIC_Failure = 0x3d
        }

        private HCIVendorSpecificEventHostErrorCode _status;
        private ushort _connHandle;
        private ReasonEnum _reason;

        public ushort ConnHandle
        {
            get { return _connHandle; }
            set { _connHandle = value; }
        }

        public HCIVendorSpecificEventHostErrorCode Status
        {
            get { return _status; }
            set { _status = value; }
        }

        public ReasonEnum Reason
        {
            get { return _reason; }
            set { _reason = value; }
        }

        public HCIEvent_GAP_Link_Terminated(
            HCIVendorSpecificEventHostErrorCode status,
            ushort connHandle,
            ReasonEnum reason)
            :base((ushort)HCIVendorSpecificEventEventOpcode.GAP_Link_Terminated)
        {
            _status = status;
            _connHandle = connHandle;
            _reason = reason;
        }
    }
}
